/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package network.packets;

import utils.StringUtils;
import utils.Utils;

/**
 *
 * @author kvest
 */
public class MyInfoResponce extends Packet
{
    private String info;

    public MyInfoResponce(byte[] data)
    {
        super(MY_INFO_RESPONCE, data);
    }

    public void parse(byte[] data)
    {
        int offset = 2;

        //Текст информации
        byte[] tmp = new byte[4];
        System.arraycopy(data, offset, tmp, 0, tmp.length);
        offset += tmp.length;
        tmp = new byte[Utils.byteToInt(tmp)];
        System.arraycopy(data, offset, tmp, 0, tmp.length);
        offset += tmp.length;
        info = StringUtils.bytesToStr(tmp);

        tmp = null;
    }

    public void print()
    {
        System.out.println("MyInfoResponce={" + info + "}");
    }

    public String getInfo()
    {
        return info;
    }
}
